﻿#region Header
// ------------------------ Licence / Copyright ------------------------
// 
// ScrumTable for Scrum Meeting Support
// Copyright © HSR - Hochschule für Technik Rapperswil
// All Rights Reserved
// 
// Author:
//  Michael Gfeller Silvan Gehrig Patrick Boos
// 
// ---------------------------------------------------------------------
#endregion

#region Usings

using Microsoft.VisualStudio.TestTools.UnitTesting;
using ScrumTable.Common.Data.Tracking;

#endregion 

namespace ScrumTable.Common.Test.Tracking
{
    /// <summary>
    /// This is the test class for RevisionManager class.
    /// </summary>
    [TestClass]
    public class RevisionManagerTest
    {
        #region Declarations
        //--------------------------------------------------------------------
        // Declarations
        //--------------------------------------------------------------------

        #endregion

        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext { get; set; }

        #endregion

        #region Additional test attributes
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test 
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        #region Constructors / Destructor
        //--------------------------------------------------------------------
        // Constructors / Destructor
        //--------------------------------------------------------------------

        /// <summary>
        /// Creates a new RevisionManagerTest instance.
        /// </summary>
        public RevisionManagerTest()
        {
        }

        #endregion

        #region Methods
        //--------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------

        [TestMethod]
        public void TestNext()
        {
            RevisionManager revMgr = new RevisionManager();
            Assert.AreEqual(0.0, revMgr.Current);
            revMgr.Next();
            Assert.AreEqual(1.0, revMgr.Current);
        }

        [TestMethod]
        public void TestCurrent()
        {
            Assert.AreEqual(0.0, new RevisionManager().Current);
        }

        [TestMethod]
        public void TestIsInitial()
        {
            RevisionManager revMgr = new RevisionManager();
            Assert.IsTrue(revMgr.IsInitial);
            revMgr.Next();
            Assert.IsFalse(revMgr.IsInitial);
        }

        [TestMethod]
        public void TestReset()
        {
            RevisionManager revMgr = new RevisionManager();
            revMgr.Next();
            Assert.IsFalse(revMgr.IsInitial);
            revMgr.Reset();
            Assert.IsTrue(revMgr.IsInitial);
        }

        [TestMethod]
        public void TestClone()
        {
            RevisionManager revMgr = new RevisionManager();
            revMgr.Next();
            RevisionManager revMgrClone = revMgr.Clone();
            Assert.AreEqual(revMgr.Current, revMgrClone.Current);
            revMgrClone.Next();
            Assert.AreNotEqual(revMgr.Current, revMgrClone.Current);
            revMgr.Next();
            Assert.AreNotEqual(revMgr.Current, revMgrClone.Current);
            revMgrClone.Next();
            Assert.AreNotEqual(revMgr.Current, revMgrClone.Current);
        }

        #endregion

        #region Events
        //--------------------------------------------------------------------
        // Events
        //--------------------------------------------------------------------

        #endregion
    }
}